//
//  MCGetAutoCodeModel.m
//  ZXZX
//
//  Created by menhao on 2018/9/3.
//  Copyright © 2018年 TLYL01. All rights reserved.
//

#import "MCGetAutoCodeModel.h"

@implementation MCGetAutoCodeModel

- (NSString *)urlPathComponentForManagerWithManager:(ApiBaseManager *)manager{
    if ([self.type isEqualToString:@"1"]) {
          return @"web-api/api/v4/get_auth_code_new?type=1";
    } else {
          return @"web-api/api/v4/get_auth_code_new?type=0";
    }
   
}



- (void)managerCallAPIDidSuccessWithManager:(ApiBaseManager *)manager{
    [BKIndicationView dismiss];
    if (self.callBackSuccessBlock) {
        self.callBackSuccessBlock(manager.ResponseRawData);
    }
    if ([self.type isEqualToString:@"0"]) {
    NSDictionary *dict = manager.ResponseHeader;
    NSString *str = dict[@"APIID"];
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:str forKey:@"cookie_id"];
    [userDefaults synchronize];
    }
}

- (void)managerCallAPIDidFailedWithManager:(ApiBaseManager *)manager errorCode:(NSString *)errorCode{
    [BKIndicationView dismiss];
    if (self.callBackFailedBlock) {
        self.callBackFailedBlock(manager, errorCode);
    }
}
@end
